package com.zh.note.huawei.onehundred.查找重复代码;

/**
 * @Author: zhanghuan
 * @date: 2023/8/9 08:34
 * @description: create it
 */
public class Main {
    public static void main(String[] args) {
        // Scanner sc = new Scanner(System.in);
        // String text1 = sc.nextLine();
        // String text2 = sc.nextLine();
        String text1 = "private_void_method";
        String text2 = "public_void_method";
        String minValueStr = text1.length() <= text2.length() ? text1 : text2;
        String maxValueStr = minValueStr.equals(text1) ? text2 : text1;
        String res = "";
        for (int i = 0; i < minValueStr.length() - 1; i++) {
            for (int j = i + 1; j <= minValueStr.length(); j++) {
                String temp = minValueStr.substring(i, j);
                if (temp.length() > res.length() && maxValueStr.contains(temp)) {
                    res = temp;
                }
            }
        }
        System.out.println(res);

    }
}
